--- libtool.orig	2009-07-15 16:25:32 +0200
+++ libtool	2009-07-15 16:51:56 +0200
@@ -3319,7 +3319,14 @@
 		  ;;
 		esac
 		if grep "^installed=no" $deplib > /dev/null; then
-		  path="$absdir/$objdir"
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  eval library_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  for library_name in ${library_names}; do :; done
+		  if test $mode = relink && test -f "${inst_prefix_dir}${libdir}/${library_name}"; then
+		     path="${inst_prefix_dir}${libdir}"
+		  else
+		    path="$absdir/$objdir"
+		  fi
 		else
 		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		  if test -z "$libdir"; then
